<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>MOVE Instruction</title>
<link href="../edit68k.css" rel="stylesheet" type="text/css">
</head>

<body>
<h1 class="heading">MOVE Instruction<BR></h1>
<hr noshade>
</h1>
          <BR>
          <span class="text">The instruction MOVE copies a byte, word, or longword from one effective address to another. The flags are set according to the data moved.</span></P>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
  <TBODY>
    <TR>
      <TD width="34%" class="text">ADDRESS METHODS (source): </TD>
      <TD width="66%"><span class="text">Dn, An, (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l </span>
          <P class="text">x(PC), x(PC,xr.s), #x</P></TD>
    </TR>
  </TBODY>
</TABLE>
<P class="text">ADDRESS METHODS (for the destination): Dn, (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l<BR>
          <BR>
  The address method An can only be used when the data length is a word or a longword.</P>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="27%">
  <TBODY>
    <TR>
      <TD width="31%" rowSpan=5 vAlign=top class="text">FLAGS:</TD>
      <TD width="69%" class="text">X - U</TD>
    </TR>
    <TR>
      <TD width="69%" class="text">N - S</TD>
    </TR>
    <TR>
      <TD width="69%" class="text">Z - S</TD>
    </TR>
    <TR>
      <TD width="69%" class="text">C - 0</TD>
    </TR>
    <TR>
      <TD width="69%" class="text">V - 0</TD>
    </TR>
  </TBODY>
</TABLE>
<P><span class="text">SYNTAX: MOVE &lt;ea&gt;,&lt;ea&gt;<BR>
      <BR>
  The instruction MOVEA moves data to an address register (An is, as you may have noticed missing in address methods for the destination). Most assemblers choose MOVEA is you have an address register as an operand.<BR>
</span></P>
<P><span class="text">EXAMPLE CODE:</span></P>
<P class="sourcecode"><span class="text">&nbsp;&nbsp;&nbsp; MOVE.B&nbsp;&nbsp;&nbsp; D0,D1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;moves the lower 8 bits of D0 to D1, does not change the upper 24 bits of D0 or 
D1<br>
&nbsp;&nbsp;&nbsp; MOVE.W&nbsp; &nbsp;D0,D1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;moves the lower 16 bits of D0 to D1, does not change the upper 16 bits of D0 or 
D1<br>
&nbsp;&nbsp;&nbsp; MOVE.L&nbsp;&nbsp;&nbsp; D0,D1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
 
moves all 32 bits of D0 to D1</span></P>
<h1 class="subheading">MOVE to CCR<BR>
  </h1>
  <hr noshade>
</h1>
<BR>
<span class="text">If you specify CCR as the destination, the lower byte of a word is copied to the flag register (CCR). The flags do are not affected by the result, i.e. if you clear the flag register the Z flag won't be set.</span>
<p></P>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
  <TBODY>
    <TR>
      <TD width="26%" class="text">ADDRESS METHODS:</TD>
      <TD width="74%" class="text">Dn, (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l,x(PC), x(PC,xr.s), #x</TD>
    </TR>
  </TBODY>
</TABLE>
<P><span class="text">DATA LENGTH: Word<BR>
      <BR>
  FLAGS: Set according to the bits of the byte you moved to CCR.<BR>
  <BR>
  SYNTAX: MOVE &lt;ea&gt;,CCR</span>
</P>
<P><span class="text">EXAMPLE CODE:</span></P>
<P class="sourcecode"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp; MOVE&nbsp;&nbsp;&nbsp; D0,CCR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
 
moves the lower 16 bits of D0 into the CCR</font></P>
<P><h1 class="subheading">MOVE to SR<br></h1>
<hr noshade></h1><BR>
<span class="text">If you specify SR as the destination, a word is moved to the status register (i.e. the system byte and the flag byte). The instruction requires that the supervisor bit is set. The instruction can be used to change the T-bit (trace), S-bit (supervisor), the interrupt mask and the flags. Note that with Fargo II, to get into supervisor mode, you should use the trap #1.<BR>
  <BR>
If you only want to change the flags, you should use MOVE to CCR instead, which also works if you are in user mode.</span></P>
  <br>
  <br>
  <TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
  <TBODY>
    <TR>
      <TD width="28%" class="text">ADDRESS METHODS:</TD>
      <TD width="72%" class="text">Dn, (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l, x(PC), x(PC,xr.s), #x</TD>
    </TR>
  </TBODY>
</TABLE>
<P><span class="text">DATA LENGTH: Word<BR>
      <BR>
  FLAGS: Set according to the lower bits in the word you moved to SR.<BR>
  <BR>
  SYNTAX: MOVE &lt;ea&gt;,SR</span><P><span class="text">EXAMPLE CODE:</span><P class="sourcecode">
<span class="text">&nbsp;&nbsp; MOVE.W&nbsp;&nbsp;&nbsp; D0,SR&nbsp;&nbsp;&nbsp; *Moves the 
lower word in D0 to the SR</span><h1 class="subheading">MOVE from SR<BR></h1>
<hr noshade></h1>
  <BR>
  <span class="text">This instruction copies the whole status register to an operand with the size of a word. It requires that you are in supervisor mode (the S-bit in SR must be set).<BR>
  <BR>
  ADDRESS METHODS: Dn, (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l<BR>
  <BR>
  DATA LENGTH: Word<BR>
  <BR>
  FLAGS: Unaffected<BR>
  <BR>
  SYNTAX: MOVE SR,&lt;ea&gt;</span><p><span class="text">EXAMPLE CODE:</span></p>
<P class="sourcecode"><span class="text">&nbsp;&nbsp; MOVE.W&nbsp;&nbsp;&nbsp; SR,D0&nbsp;&nbsp;&nbsp; *Moves 
the SR into the lower word of D0</span><p>&nbsp;</p>
<p>&nbsp;</p>
<p>
  <span class="text"><BR>
</span></p>
</P>
<P>&nbsp; </P>
</body>
</html>